from amscms.private_messages.models import inbox_count_for

def inbox(request):
    if hasattr(request, 'user'):
        if request.user.is_authenticated():
            return {'messages_inbox_count': inbox_count_for(request.user)}
        else:
            return {}
    else:
        return {}